package com.allen.study.infrastructure.persistence.assembler;

import com.allen.study.application.api.response.LeaveApplyQueryResponse;
import com.allen.study.domain.entity.LeaveApply;
import com.allen.study.infrastructure.persistence.assembler.mapper.ILeaveApplyPOStructMapper;
import com.allen.study.infrastructure.persistence.po.LeaveApplyPO;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 请假申请表类型转换
 *
 * @author AllenSun
 * @since 2025-04-23 20:46
 */
@Component
public class LeaveApplyPOAssembler {

    /**
     * 请假申请表持久化对象装配
     *
     * @param leaveApply 请假申请表实体
     * @return 请假申请表持久化对象
     */
    public LeaveApplyPO assembler(LeaveApply leaveApply) {
        return ILeaveApplyPOStructMapper.INSTANCE.fromEntity(leaveApply);
    }

    /**
     * 请假申请表持久化对象装配
     *
     * @param leaveApplyList 请假申请表实体
     * @return 请假申请表持久化对象
     */
    public List<LeaveApplyPO> assembler(List<LeaveApply> leaveApplyList) {
        return ILeaveApplyPOStructMapper.INSTANCE.fromEntity(leaveApplyList);
    }

    /**
     * 请假申请表持久化对象 转 请假申请表实体
     *
     * @param leaveApplyPO 请假申请表持久化对象
     * @return 请假申请表实体
     */
    public LeaveApply toEntity(LeaveApplyPO leaveApplyPO) {
        return ILeaveApplyPOStructMapper.INSTANCE.toEntity(leaveApplyPO);
    }

    /**
     * 请假申请表持久化对象列表  转 请假申请表实体列表
     *
     * @param leaveApplyPOList 请假申请表持久化对象
     * @return 请假申请表实体
     */
    public List<LeaveApply> toEntity(List<LeaveApplyPO> leaveApplyPOList) {
        return ILeaveApplyPOStructMapper.INSTANCE.toEntity(leaveApplyPOList);
    }

    /**
     * 请假申请表持久化对象 转 请假申请表查询响应数据传输对象
     *
     * @param leaveApplyPO 请假申请表持久化对象
     * @return 请假申请表查询响应数据传输对象
     */
    public LeaveApplyQueryResponse toQueryResponse(LeaveApplyPO leaveApplyPO) {
        return ILeaveApplyPOStructMapper.INSTANCE.toQueryResponse(leaveApplyPO);
    }

    /**
     * 请假申请表持久化对象列表 转 请假申请表查询响应数据传输对象列表
     *
     * @param leaveApplyPOList 请假申请表持久化对象列表
     * @return 请假申请表查询响应数据传输对象列表
     */
    public List<LeaveApplyQueryResponse> toQueryResponse(List<LeaveApplyPO> leaveApplyPOList) {
        return ILeaveApplyPOStructMapper.INSTANCE.toQueryResponse(leaveApplyPOList);
    }
}
